package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class FindOperation implements Iop{
    @Override
    public void work(BookList bookList) {
        System.out.println("查询图书");
        System.out.println("请输入你要查找的书");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        int num = bookList.getNum();
        for (int i = 0; i <num ; i++) {
            if (name.equals(bookList.getBooks(i).getName())){
                System.out.println("找到了");
                System.out.println(bookList.getBooks(i));
                return;
            }
        }
        System.out.println("没有这本书");
    }
}
